package library.gui.component;

import javafx.geometry.Pos;
import javafx.scene.control.Label;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane;
import library.core.user.User;

public class UserPane extends BorderPane{

	private static final Image DEFAULT = new Image("/p.png"); 
	
	private Label id;
	private ImageView icon;
	private Label name;
	
	public UserPane(User user, int width) {
		id = new Label("ID：" + user.getId());
		name = new Label(user.getName());
		icon = new ImageView(DEFAULT);
		icon.setFitWidth(width);
		icon.setFitHeight(width);
		this.setStyle("-fx-border-style: solid; -fx-border-color: silver");
		this.setTop(id);
		BorderPane.setAlignment(id, Pos.CENTER);
		this.setCenter(icon);
		BorderPane.setAlignment(icon, Pos.CENTER);
		this.setBottom(name);
		BorderPane.setAlignment(name, Pos.CENTER);
	}
	
}
